import React from 'react'
import {Menu , Icon} from 'antd'


const getMenus = (arr)=>{
    return arr.map((item) => {
        if(item.name){
            return (
                <Menu.Item key={item.id}>
                <span>{item.name}</span><span>[{item.display_name}]</span>
                </Menu.Item>
            )
        }
        return (
            <Menu.Item key={item.id}>
                <div>{item.display_name}</div>
            </Menu.Item>
        )
        
    })
}

class LeftMenus extends React.Component {
    constructor(props){
        super(props)
        this.componentDidMount.bind(this)
    }
    
    componentDidMount(){
        
    }
    render(){
        const menuKey = new Array(this.props.menuKey)
        return (
            <Menu
                onClick={this.props.onClick}
                
            >
                {getMenus(this.props.menuArr)}
            </Menu>
        )
    }
}

export default LeftMenus 